/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-05-04 09:50:21
 * @LastEditTime : 2023-08-24 10:02:41
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\FirstLevel\FinanceIncomeOutlayBasicRecordPeriod.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList, BuiltInData } from '../Common/common'
import { AddDataButton, ModDataButton, DelDataButton, OpenExcelButton } from '../Common/options'

export const FinanceIncomeOutlayBasicRecordPeriod = async ({
    url,
    OptionsEvent,
    ClientData,
    Permission,
    actionRef,
}) => {
    let data = {
        pageSize: 10,
        params: { pageIndex: 1 },
        get: API_LIST()[`get${url}`],
        added: `pos${url}`,
        modify: `put${url}`,
        delete: `del${url}`,
        hideInSearch: true,
        options: [<AddDataButton OptionsEvent={OptionsEvent} type="primary" icon="add" title="新增" />],
        columns: [
            commonTableList.uuid,
            {
                dataIndex: 'year',
                title: '年份',
                valueType: 'Date',
                picker: 'year',
                ellipsis: true,
                rules: true,
                width: 150,
            },
            {
                dataIndex: 'month',
                title: '月份',
                valueType: 'select',
                valueEnum: BuiltInData.monthList,
                ellipsis: true,
                rules: true,
                width: 150,
            },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 400,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    const { year, month } = record
                    return [
                        <ModDataButton OptionsEvent={OptionsEvent} key="modify" title="修改" data={record} />,
                        <OpenExcelButton
                            key="one"
                            title="录入"
                            OptionsEvent={OptionsEvent}
                            data={{
                                save: true,
                                submit: true,
                                year,
                                month,
                                url: 'getFinanceIncomeOutlayBasicRecordInputExcel',
                                pos: 'posFinanceIncomeOutlayBasicRecordSync',
                            }}
                        />,
                        <OpenExcelButton
                            key="two"
                            title="查看"
                            OptionsEvent={OptionsEvent}
                            data={{
                                save: true,
                                year,
                                month,
                                url: 'getFinanceIncomeOutlayBasicRecordStatExcel',
                            }}
                        />,

                        <DelDataButton
                            OptionsEvent={OptionsEvent}
                            key="del"
                            title="删除"
                            url={url}
                            uuid={record.uuid}
                        />,
                    ]
                },
            },
        ],
    }

    return data
}
